package com.woniuxy.resolver;

import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author: ideaAdmin
 * TODO: 异常处理
 * Date: 2022/2/9:18:52
 * Description:
 */

public class MyExceptionResolver implements HandlerExceptionResolver {
    @Override
    public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception exception) {
        ModelAndView modelAndView = new ModelAndView();
        exception.printStackTrace();
        if(exception instanceof  RuntimeException){

       }
        modelAndView.setViewName("html/404");
        return modelAndView;
    }
}
